//package com.legna.xyq.alert.service;
//
//import cn.hutool.core.io.file.FileReader;
//import com.alibaba.fastjson.JSONArray;
//import com.alibaba.fastjson.JSONObject;
//
//import java.util.ArrayList;
//import java.util.List;
//import java.util.Set;
//
//public class GenerateNewJson {
//
////    public static void main(String[] args) {
////        FileReader fileReader = new FileReader("D:\\IdeaProjects\\xyq-alert\\src\\main\\resources\\cb2.json");
////        String result = fileReader.readString();
////
////        JSONObject jsonObject = JSONObject.parseObject(result);
////
////        Set<String> keySet = jsonObject.keySet();
////        for (String key : keySet) {
////            if (key.equals("total")){
////                continue;
////            }
////            JSONArray jsonArray = jsonObject.getJSONArray(key);
////            JSONArray header = jsonArray.getJSONArray(1);
////            JSONObject name = header.getJSONObject(0);
////            String title = name.getString("title");
////            if (title.contains("项目")){
////                JSONArray newdata = new JSONArray();
////                JSONArray newunit = new JSONArray();
////
////                JSONArray data = jsonArray.getJSONArray(jsonArray.size() - 1);
////
////                for (int i = 0; i < data.size(); i++) {
////                    JSONObject jsonObject1 = data.getJSONObject(i);
////                    String field = jsonObject1.getString("field");
////                    jsonObject1.put("field","");
////                    String title1 = jsonObject1.getString("title");
////                    String[] split = title1.split("（");
////                    String width;
////                    if (split[0].length() <= 4){
////                        width = "100px";
////                    }else if (split[0].length() == 5){
////                        width = "120px";
////                    }else if (split[0].length() == 6){
////                        width = "140px";
////                    }else if (split[0].length() == 7){
////                        width = "160px";
////                    }else if (split[0].length() == 8){
////                        width = "180px";
////                    }else{
////                        width = "180px";
////                    }
////
////                    jsonObject1.put("width",width);
////                    jsonObject1.put("title",split[0]);
////                    newdata.add(i,jsonObject1);
////
////                    JSONObject jsonObject2 = new JSONObject();
////                    jsonObject2.put("field",field);
////                    jsonObject2.put("width",width);
////                    jsonObject2.put("align","center");
////                    if (split.length > 1){
////                        jsonObject2.put("title",split[1].replace("）",""));
////                    }else{
////                        jsonObject2.put("title","--");
////                    }
////                    newunit.add(i,jsonObject2);
////                }
////                jsonArray.remove(2);
////                jsonArray.add(2,newdata);
////                jsonArray.add(3,newunit);
////            }
////            jsonObject.put(key,jsonArray);
////        }
////        System.out.println(JSONObject.toJSONString(jsonObject));
////    }
//
//
//
//    public static void main(String[] args) {
//        FileReader fileReader = new FileReader("D:\\IdeaProjects\\xyq-alert\\src\\main\\resources\\cb2.json");
//        String result = fileReader.readString();
//
//        JSONObject jsonObject = JSONObject.parseObject(result);
//        JSONObject req = new JSONObject();
//        Set<String> keySet = jsonObject.keySet();
//        for (String key : keySet) {
//            List<String> tags = new ArrayList<>();
//            JSONArray jsonArray = jsonObject.getJSONArray(key);
//            int size = jsonArray.size();
//            JSONArray header = jsonArray.getJSONArray(1);
//            JSONObject name = header.getJSONObject(0);
//            String title = name.getString("title");
//
//            JSONArray data = jsonArray.getJSONArray(size-1);
//
//            for (int i = 0; i < data.size(); i++) {
//                JSONObject jsonObject1 = data.getJSONObject(i);
//                String field = jsonObject1.getString("field");
//                if (!field.contains("_time")){
//                    tags.add(field);
//                }
//            }
//            req.put(key,tags);
//        }
//        System.out.println(JSONObject.toJSONString(req));
//    }
//}
